Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
@commitlint/lint
Advanced tools
The @commitlint/lint package is a part of the commitlint toolset that is used to lint commit messages according to a specified set of rules. It helps maintain a consistent commit history and enforces a commit message convention, which is beneficial for automated processing of commit logs, generating changelogs, and aiding in code reviews.
Linting Commit Messages
This feature allows you to lint commit messages using a set of predefined rules. The code sample demonstrates how to use the lint function to check if a commit message follows the specified rules for the commit type and subject case.
const { lint } = require('@commitlint/lint');
const message = 'feat: add new feature';
const rules = {
'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'style', 'refactor', 'test', 'chore']],
'subject-case': [2, 'never', ['start-case', 'pascal-case', 'upper-case']]
};
lint(message, rules).then(report => {
console.log(report);
});
commitlint is the core package that includes @commitlint/lint as part of its toolset. It provides a CLI and can be extended with plugins and shareable configurations. It is essentially the same tool but with a broader scope.
conventional-changelog-lint is a predecessor to commitlint and offers similar functionality for linting commit messages based on the conventional changelog standard. It has been deprecated in favor of commitlint.
validate-commit-msg is another deprecated package that was used to validate commit messages. It has been replaced by commitlint, which offers a more modern and flexible approach to commit message validation.
Lint a string against commitlint rules
npm install --save @commitlint/lint
const lint = require('@commitlint/lint').default;
lint('foo: bar', {'type-enum': [1, 'always', ['foo']]}).then((report) =>
console.log(report)
);
// => { valid: true, errors: [], warnings: [] }
lint('foo: bar', {'type-enum': [1, 'always', ['bar']]}).then((report) =>
console.log(report)
);
/* =>
{ valid: true,
errors: [],
warnings:
[ { level: 1,
valid: false,
name: 'type-enum',
message: 'type must be one of [bar]' } ] }
*/
Consult docs/api for comprehensive documentation.
17.8.1 (2023-10-20)
Note: Version bump only for package @commitlint/root
FAQs
Lint a string against commitlint rules
The npm package @commitlint/lint receives a total of 3,264,562 weekly downloads. As such, @commitlint/lint popularity was classified as popular.
We found that @commitlint/lint demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.